/*
 * @Author: C.
 * @Date: 2023-03-31 09:59:54
 */
import { defHttp } from '/@/utils/http/axios';

enum Api {
  GetAllRole = '/role/list',
  GetRoleMember = '/role/get_role_member',
  GetRolePermission = '/role/get_role_permission',
  SaveRole = '/role/save',
  DeleteRole = '/role/delete',
  SaveRoleMember = '/role/save_role_member',
  SaveRolePermission = '/role/save_role_permission',
}

// /role/get_all
// 获取所有角色
export const getRoleList = (params: any) => {
  return defHttp.post({ url: Api.GetAllRole, params });
};
// GET /role/get_role_member
// 根据角色编号获取角色成员
export const getRoleMember = (params: any) => {
  return defHttp.get({ url: Api.GetRoleMember, params });
};
// GET /role/get_role_permission
// 根据角色编号获取角色权限
export const getRolePermission = () => {
  return defHttp.get({ url: Api.GetRolePermission });
};
// POST /role/save
// 编辑角色
export const saveRole = (params: any) => {
  return defHttp.post({ url: Api.SaveRole, params });
};
// POST /role/delete
// 删除角色
export const deleteRole = (params: any) => {
  return defHttp.post({ url: Api.DeleteRole, params });
};
// POST /role/save_role_member
// 编辑角色成员
export const saveRoleMember = (params: any) => {
  return defHttp.post({ url: Api.SaveRoleMember, params });
};
// POST /role/save_role_permission
// 编辑角色权限
export const saveRolePermission = () => {
  return defHttp.post({ url: Api.SaveRolePermission });
};
